'use strict';

const conn = require('../../libs/DB/Conn');
/*const regex = require('../../../libs/regex');*/
module.exports = async function (params) {

    if (params.agentName) {
        let insertObj = {
            agent_name: params.agentName,
            agent_principal: params.agentPrincipal,
            phone_number: params.phoneNumber,
            company_addr: params.companyAddr
        };
        if (params.pAgentId) insertObj['p_id'] = params.pAgentId;
        await conn(`INSERT INTO agent_file SET ?`, [insertObj]);
        return {success: true}

    } else {
        return {success: false}
    }

};